package com.oak.designmode._02_strategy;


/**
 * 策略模式
 *
 * @ClassName: Clienter
 * @Description  封装起各个算法，由context对象统一管理调用
 * @Author guoxy
 * @Date 2019/12/3 0003
 * @Version 1.0
 */
public class Test {

    public static void main(String[] args) throws Exception {
        Context context = new Context();

        int a = 10;
        int b = 2;

        context.setOperation(new Plus());
        System.out.println("a + b = " + context.excuteOperation(a, b));

        context.setOperation(new Minus());
        System.out.println("a - b = " + context.excuteOperation(a, b));

        context.setOperation(new Multiply());
        System.out.println("a * b = " + context.excuteOperation(a, b));

        context.setOperation(new Divide());
        System.out.println("a / b = " +  + context.excuteOperation(a, b));

    }
}